﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SCM.API.Read.Application.Command.Ledger;
using SCM.ErrorCode;
using SCM.Extensions.Ledger;

namespace SCM.API.Read.Controllers.ledger
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LedgerController : ControllerBase
    {
        IMediator mediator;

        public LedgerController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public async Task<APIPaging<StockDTO>> ShowStock([FromQuery]GetStockCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIPaging<EnterOutDTO>> ShowEnterOut([FromQuery]GetEnterOutCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIPaging<DistributeDTO>> ShowDistribute([FromQuery]GetDistributeCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIPaging<GuaranteeDTO>> ShowGuarantee([FromQuery]GetguaranteeCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIPaging<WarnDTO>> ShowWarn([FromQuery]GetWarnCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
